/* D:\ICADDEV\PRJ\ICAD\dmFontComboBox.H
 * Copyright (C) 1997-1999 DIMINE Co.LTD. All rights reserved.
 * 
 * $Revision: 1.1.1.1 $ $Date: 2010/03/03 02:57:11 $ 
 * 
 * Abstract
 * 
 * <TODO : Add Abstract here>
 * 
 */ 

#if !defined _ICADFONTCOMBOBOX_H
#define _ICADFONTCOMBOBOX_H

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

// dmFontComboBox.h : header file
//

const int GET_FONT_TTF = 1;						// bit flags for type of fonts to list in combo box
const int GET_FONT_SHX = 2;
const int GET_FONT_SHP = 4;

//WARNING!!!!!!! - Windows uses RASTER_FONTTYPE, DEVICE_FONTTYPE, and TRUETYPE_FONTTYPE to indicate the
//				   type of a font.  These are 0x0001, 0x002, and 0x004, respectively.  If Windows adds
//				   more types or changes their values, we may need to change the values below to ensure
//				   that we are using unique values for the CAD font types we support.
const int SHX_FONTTYPE = -16000;
const int SHP_FONTTYPE = -16001;


struct FontItem
	{
	TCHAR fontName[LF_FACESIZE]; 
	DWORD fontType;
	LOGFONT logFont;	// WARNING!!!!!!! - always check fontType before trusting logFont
	};					// logFont will not be valid for shx and shp fonts

/////////////////////////////////////////////////////////////////////////////
// CdmFontComboBox

class CdmFontComboBox : public CComboBox
{
	//for test 
private:
	int m_CountFountType;
// Construction
public:
	CdmFontComboBox();
	virtual ~CdmFontComboBox();

// Attributes
public:
	enum
		{
		WM_FONT_NAME_CHANGED = (WM_USER + 1)
		};

// Operations
public:
	void FillFontComboBox(const int bitCode);
	void AddTrueTypeFonts(void);
	static int CALLBACK EnumFontFamExProc(ENUMLOGFONTEX *enumLogFontEx,
		NEWTEXTMETRICEX *newTextMetricEx, int fontType, LPARAM lParam);
	void AddCADFonts(const CString& fileSpec, const int fontType);
	int AddFont(LOGFONT *logFont, DWORD fontType, char *fontName);
	void SetCurrentFont(const char* fontName);

	LPLOGFONT GetLogFont(int selection = -1);
	DWORD GetFontType(int selection = -1);
	FontItem * GetFontItem(const int selection = -1);
	bool HaveTrueTypeFont(void);

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CdmFontComboBox)
	//}}AFX_VIRTUAL

// Implementation
public:
//	virtual void DeleteItem(LPDELETEITEMSTRUCT item);	// to do - maybe remove this

// Member variables
protected:
	int m_getWhichFonts;
	CString m_fontName;

// Generated message map functions
protected:
	//{{AFX_MSG(CdmFontComboBox)
	afx_msg void OnSelChange();
	afx_msg void OnDestroy();
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.


/////////////////////////////////////////////////////////////////////////////
// CdmFontComboBox inline functions


#endif // _ICADFONTCOMBOBOX_H



